package com.example.demo.web;

import com.demo.sample.common.OperationResponse;
import com.example.demo.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("storage")
public class StorageController {

    @Autowired
    private StorageService storageService;

    @PostMapping("deduct")
    public OperationResponse deduct(String commodityCode, int count) throws Exception {
        return storageService.deduct(commodityCode, count);
    }
}
